import java.io.IOException;
import java.util.List;

class ThreadDemo extends Thread {
    private Thread t;
    private String threadName;

    ThreadDemo(String name) {
        threadName = name;
    }

    @Override
    public void run() {
        System.out.println("Running " + threadName);
        Craw.savePic(threadName);
        System.out.println("Thread " + threadName + " exiting.");
    }
}

/**
 * @author jou
 */
public class TestThread {

    public static void main(String[] args) throws IOException {
        long t0 = System.currentTimeMillis();

        List<String> missions = Craw.getMatchString("zhihu.html", "utf-8");
        for (String mission : missions) {
            Thread t = new ThreadDemo(mission);
            t.start();
        }
        long t1 = System.currentTimeMillis();
        System.out.printf("time spend: %d\n", t1 - t0);
    }
}